﻿using System;
using System.Data;
using Extensions;
using OTS.Utility;
using DevTeam;
using DevExpress.XtraGrid.Views.Grid;

namespace OTS
{
    public partial class ResmiTatiller : XForm
    {
        public ResmiTatiller()
        {
            InitializeComponent();

            DataTable dt = AppSession.DataManager.ExecuteDataTable("GetTatilGunleri");
            dt.AddAutoIncrementalColumn("TatilId", -1, -1);
                        
            gvResmiTatiller.Init(dt);
            gvResmiTatiller.FormatAsDate("Tarih");
            gvResmiTatiller.BestFitColumns();
            gvResmiTatiller.MoveLast();

            gvResmiTatiller.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;            
            btnKaydet.Click += Kaydet_Click;
        }   

        private void Kaydet_Click(object sender, EventArgs e)
        {
            gvResmiTatiller.Update();
            DataTable dt = AppSession.DataManager.ExecuteDataTable("GetTatilGunleri");
            gvResmiTatiller.VeriyiGuncelle(dt);  
        }
    }
}